package CollectionsFramework;

import java.util.function.Consumer;
import java.util.function.Function;   //转换数据的函数式接口 需要两个参数
import java.util.function.Predicate;
import java.util.function.Supplier;

public class ToUpper  implements Function <String,Integer> {
    @Override
    public Integer apply(String s) {
        return Integer.parseInt(s);  //字符串转整型
    }

    public static void main(String[] args) {
//        System.out.println(new ToUpper().apply("123"));
        Function<String,String> function = s -> s.toUpperCase();
        System.out.println(function.apply("aadDD"));

        Consumer<String> consumer = System.out::println;   //消费者
        consumer.accept("666");

        //供应商
        Supplier<String>stringSupplier = () -> "hellosupplier"; //小括号只能在有一个参数的时候省略
        System.out.println(stringSupplier.get());

        //断言
        Predicate<String>predicate = s -> s.contains("a");
        System.out.println(predicate.test("abc"));

    }

}
